new Vue({
    el: '#app',
    data: {
        active: 2,
        loading: true,
        amount: '',
        value: '',
        errorInfo: '',
        showKeyboard: false,
    },
    mounted: function () {
        this.main();
    },
    methods: {
        main: function () {
            // $http.get('/api/user/getUserInfo').then(res => {
            //   this.user = res.data.data
            //   return $http.get('/api/index/systemdeta')
            // }).then( (res) => {
            //   this.usdturl = res.data.data.usdturl
            // })
        },
        onClickLeft: function () {
            history.go(-1);
        },
        onInput: function (key) {
            var _this = this;
            this.value = (this.value + key).slice(0, 6);
            if (this.value.length !== 6) {
                return;
            }
            $http.get('/api/otc/createsellOrder').then(function (res) {
                if (res.data.code != 1) {
                    _this.value = '';
                    return _this.errorInfo = res.data.msg;
                }
                _this.$toast.success({
                    message: res.data.msg,
                    onClose: function () { history.go(-1); }
                });
            });
        },
        onDelete: function () {
            this.value = this.value.slice(0, this.value.length - 1);
        },
        onCreateOrder: function () {
            if (!this.amount) {
                this.$toast.fail('请填写USDT数量');
                return;
            }
            this.value = '';
            this.errorInfo = '';
            this.showKeyboard = true;
        }
    }
});
